#include "GameBoard.h"
const int GameBoard::kDefaultWidth;
const int GameBoard::kDefaultHeight;

GameBoard::GameBoard(int inWidth, int inHeight ):
								mWidth(inWidth),mHaight(inHeight)
{
	mCells=new GamePiece* [mWidth];
	for (int i=0;i<mWidth;i++)
	{
		mCells[i]=new GamePiece[mHeight];
	}
}

GameBoard::GameBoard(const GameBoard& src)
{
copyFrom(src);

}

GameBoard::~GameBoard(void)
{
for (int i=0;i<mWidth; i++)
	{
		delete[] mCells[i];
	}
	delete[] mCells;
}

void GameBoard::copyFrom(const GameBoard &src)
{
	int i,j;
	mWidth=src.mWidth;
	mHeight=src.mHeight;

	mCells= new GamePiece* [mWidth];
	for(i=0;i<mWidth;i++)
	{
		mCells[i]=new GamePiece[mHeight];
	}
	for(i=0;i<mWidth;i++)
	{
		for(j=0;j<mWidth;j++)
		{
			mCells[i][j]=src.mCells[i][j];
		}
	}
}

GameBoard& GameBoard::operator =(const GameBoard& rhs)
{
if (this==&rhs)
	{
		return(*this);
	}
for (int i=0;i<mWidth;i++)
{
delete[] mCells[i];
}
delete[] mCells;
copyFrom(rhs);
return (*this);
}

void GameBoard::setPieceAt(int x,int y, const GamePiece& inElem)
{
mCells[x][y]=inElem;
}

const GamePiece& GameBoard::getPieseAt(int x, int y) const
{
return (mCells[x][y]);

}
const 